<?php
/**
* @property CI_Loader $load
* @property CI_Form_validation $form_validation
* @property CI_Input $input
* @property CI_Email $email
* @property CI_DB_active_record $db 
*
*/
class Home extends CI_Controller
{
    function  __construct()
    {
        parent::__construct();
        $this->load->helper('form');
       
    }
    function index($failed=0)
    {
        //js/jquery.validate.js"
         $data["title"]="Home";
         $data["content"]="home/content";
         $data["sidebar"]="home/sidebar";
         $js[]="home.js";
         $js[]="jquery.validate.js";
         $data["js"]=$js;
         if($failed==1)
          $data["failed"]="set";
         $this->load->view("template",$data);
         
         
    }
    function customer_login()
    {
       $this->load->model('Telephone');
       $phoneno=$this->input->post('phoneno');
       $password=$this->input->post('password');
       if($this->Telephone->login($phoneno,$password))
       {
           $newdata = array(
                   'phoneno'  => $phoneno,
                   'rank'=> 'customer',
                   'logged_in' => TRUE
               );

          $this->session->set_userdata($newdata);
          redirect('user_profile');
        }
       else
       {
            echo "ERROR";
       }
    }
    
}
?>
